<template>
  <div>
    <van-tabbar v-model="localActiveIndex" active-color="#00a36a" @change="onChange">
      <van-tabbar-item>
        <span>首页</span>
        <template #icon="props">
          <img :src="props.active ? active : inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item>
        <span>我的</span>
        <template #icon="props">
          <img :src="props.active ? active2 : inactive2" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import active from '@/assets/组 5814@2x.png'
import inactive from '@/assets/组 5812@2x.png'
import active2 from '@/assets/组 5813@2x.png'
import inactive2 from '@/assets/组 5811@2x.png'
export default {
  name: 'tabbarIndex',
  props: {
    activeIndex: {
      type: Number,
      default: 0,
    },
  },
  components: {},
  data() {
    return {
      active,
      inactive,
      active2,
      inactive2,
      localActiveIndex: this.activeIndex,
    }
  },
  methods: {
    onChange(index) {
      if (index == 0) {
        this.$router.push('/index')
      } else {
        this.$router.push('/mine')
      }
    },
  },
  mounted() {},
  watch: {},
  computed: {},
  filters: {},
}
</script>

<style scoped lang="scss"></style>
